<template>
  <div>
    <CommonDialog ref="CommonDialog" :title="title" width="800px" @resetForm="resetForm">
      <div class="base-form_container">
        <el-form :rules="rules" :model="feedbackForm" ref="feedbackForm" label-width="140px" label-position="right">
          <el-row>
            <el-col :span="12">
              <el-form-item prop="productId" label="任务ID">
                <el-input v-model="feedbackForm.productId" placeholder="请输入任务ID"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="theirProducts" label="所属产品">
                <el-select v-model="feedbackForm.theirProducts" placeholder="请选择所属产品" clearable filterable>
                  <el-option
                    v-for="item in theirProductsList"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item prop="taskStatus" label="任务状态">
                <el-select v-model="feedbackForm.taskStatus" placeholder="请选择任务状态" clearable filterable>
                  <el-option v-for="item in taskStatusList" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="TheirProducts" label="所属产品">
                <el-input v-model="feedbackForm.TheirProducts" placeholder="请输入所属产品"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item prop="taskIdentity" label="任务标识">
                <el-select v-model="feedbackForm.taskIdentity" placeholder="请选择任务标识" clearable filterable>
                  <el-option v-for="item in taskIdentityList" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="closingDate" label="计划完成时间">
                <el-date-picker
                  :clearable="false"
                  :editable="false"
                  type="date"
                  placeholder="请选择截止日期"
                  v-model="feedbackForm.closingDate"
                  style="width: 100%"
                  value-format="yyyy-MM-dd"
                ></el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item prop="currentResponsiblePerson" label="当前责任人">
                <el-select
                  v-model="feedbackForm.currentResponsiblePerson"
                  placeholder="请选择任务标识"
                  clearable
                  filterable
                >
                  <el-option
                    v-for="item in currentResponsiblePersonList"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="department" label="责任人部门">
                <el-input v-model="feedbackForm.department" placeholder="请输入责任人部门"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item prop="trackItems" label="跟踪事项">
                <el-input type="textarea" v-model="feedbackForm.trackItems" placeholder="请输入跟踪事项"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
    </CommonDialog>
  </div>
</template>

<script>
import CommonDialog from '@/components/deleteDialog/deleteDialog.vue'
export default {
    name: '',
    components: {
        CommonDialog
    },
    props: {},
    data() {
        return {
            pickerOptions: {
                disabledDate(time) {
                    const _now = Date.now()
                    const seven = 1 * 24 * 60 * 60 * 1000
                    const sevenDays = _now - seven
                    return time.getTime() < sevenDays
                }
            },
            feedbackForm: {
                productId: '',
                theirProducts: '',
                taskStatus: '',
                TheirProducts: '',
                taskIdentity: '',
                closingDate: '',
                currentResponsiblePerson: '',
                department: '',
                trackItems: ''
            },
            rules: {
                productId: [{ required: true, message: ' ', trigger: 'change' }],
                theirProducts: [{ required: true, message: ' ', trigger: 'change' }],
                taskStatus: [{ required: true, message: ' ', trigger: 'change' }],
                TheirProducts: [{ required: true, message: ' ', trigger: 'change' }],
                taskIdentity: [{ required: true, message: ' ', trigger: 'change' }],
                currentResponsiblePerson: [{ required: true, message: ' ', trigger: 'change' }],
                department: [{ required: true, message: ' ', trigger: 'change' }]
            },
            type: '',
            title: '',
            mainFlowId: '',
            actionType: {
                create: '创建任务',
                update: '更新进度'
            },
            taskIdentityList: [
                {
                    label: 'C1',
                    value: 0
                },
                {
                    label: 'C2',
                    value: 5
                }
            ],
            currentResponsiblePersonList: [
                {
                    label: '姓名1',
                    value: 0
                },
                {
                    label: '姓名2',
                    value: 5
                }
            ],
            theirProductsList: [
                {
                    label: '产品1',
                    value: 0
                },
                {
                    label: '产品2',
                    value: 5
                }
            ],
            taskStatusList: [
                {
                    label: '新建',
                    value: 0
                },
                {
                    label: '处理中',
                    value: 5
                },
                {
                    label: '已关闭',
                    value: 10
                }
            ]
        }
    },
    computed: {},
    watch: {},
    created() {},
    mounted() {},
    methods: {
        show(_type, _id) {
            const vm = this
            this.type = _type
            this.mainFlowId = _id
            this.title = this.actionType[_type] || ''
            if (_type.indexOf('update') > -1) {
                this.getDetail(_id)
            }
            this.$refs.CommonDialog.Show('form', false, '保存', () => {
                vm.onSave()
            })
        },
        // 确认会掉
        onSave() {
            console.log('ffffff')
        },
        // 重置
        resetForm() {
            //   this.feedbackForm.details = "";
            //   this.feedbackForm.notes = "";
            //   this.encLosureList = [];
            this.$nextTick(() => {
                this.$refs.feedbackForm.resetFields()
            })
        },
        getDetail(_id) {
            console.log(_id)
        }
    }
}
</script>

<style scoped lang="less">
::v-deep .delete-dialog .dialog-header--primary {
  border-bottom: 1px solid #ffffff;
}
</style>
